GetMessage Method (Session Object) 

The GetMessage method returns a Message object from a MAPI message store.

Syntax

Set objMessage = objSession.GetMessage(messageID [, storeID] )

Parameters

objMessage

On successful return, GetMessage returns a Message object. When the specified messageID does not exist, GetMessage returns Nothing.

objSession

Required. The Session object.

messageID

Required. String that specifies the unique identifier of the message.

storeID

Optional. String that specifies the unique identifier of the message store. The default value is an empty string, which corresponds to the default message store.

 

Example

The following example displays the subject of a message from a MAPI message store:

' fragment from Session_GetMessage

' requires the parameter strMessageID;

' also uses strMessageStoreID if it is defined

    If strMessageID = "" Then

        MsgBox ("Must first set message ID variable; see Message->ID")

        Exit Function

    End If

    If strMessageStoreID = "" Then ' not present

        Set objOneMsg = objSession.GetMessage(strMessageID)

    Else

        Set objOneMsg = objSession.GetMessage(messageID:=strMessageID, _

                                    storeID:=strMessageStoreID)

    End If

 

See Also

ID, Property (Message Object)

Message ObjectC062VO